﻿using System;

namespace HslCommunication.Core.IMessage
{
	/// <summary>
	/// SAM身份证通信协议的消息
	/// </summary>
	// Token: 0x02000163 RID: 355
	public class SAMMessage : INetMessage
	{
		/// <inheritdoc cref="P:HslCommunication.Core.IMessage.INetMessage.ProtocolHeadBytesLength" />
		// Token: 0x1700060C RID: 1548
		// (get) Token: 0x06001DBC RID: 7612 RVA: 0x0008DCF1 File Offset: 0x0008BEF1
		public int ProtocolHeadBytesLength
		{
			get
			{
				return 7;
			}
		}

		/// <inheritdoc cref="P:HslCommunication.Core.IMessage.INetMessage.HeadBytes" />
		// Token: 0x1700060D RID: 1549
		// (get) Token: 0x06001DBD RID: 7613 RVA: 0x0008DCF4 File Offset: 0x0008BEF4
		// (set) Token: 0x06001DBE RID: 7614 RVA: 0x0008DCFC File Offset: 0x0008BEFC
		public byte[] HeadBytes { get; set; }

		/// <inheritdoc cref="P:HslCommunication.Core.IMessage.INetMessage.ContentBytes" />
		// Token: 0x1700060E RID: 1550
		// (get) Token: 0x06001DBF RID: 7615 RVA: 0x0008DD05 File Offset: 0x0008BF05
		// (set) Token: 0x06001DC0 RID: 7616 RVA: 0x0008DD0D File Offset: 0x0008BF0D
		public byte[] ContentBytes { get; set; }

		/// <inheritdoc cref="M:HslCommunication.Core.IMessage.INetMessage.CheckHeadBytesLegal(System.Byte[])" />
		// Token: 0x06001DC1 RID: 7617 RVA: 0x0008DD18 File Offset: 0x0008BF18
		public bool CheckHeadBytesLegal(byte[] token)
		{
			bool flag = this.HeadBytes == null;
			return !flag && (this.HeadBytes[0] == 170 && this.HeadBytes[1] == 170 && this.HeadBytes[2] == 170 && this.HeadBytes[3] == 150) && this.HeadBytes[4] == 105;
		}

		/// <inheritdoc cref="M:HslCommunication.Core.IMessage.SAMMessage.GetContentLengthByHeadBytes" />
		// Token: 0x06001DC2 RID: 7618 RVA: 0x0008DD88 File Offset: 0x0008BF88
		public int GetContentLengthByHeadBytes()
		{
			byte[] headBytes = this.HeadBytes;
			bool flag = headBytes != null && headBytes.Length >= 7;
			int result;
			if (flag)
			{
				result = (int)this.HeadBytes[5] * 256 + (int)this.HeadBytes[6];
			}
			else
			{
				result = 0;
			}
			return result;
		}

		/// <inheritdoc cref="M:HslCommunication.Core.IMessage.INetMessage.GetHeadBytesIdentity" />
		// Token: 0x06001DC3 RID: 7619 RVA: 0x00047BE1 File Offset: 0x00045DE1
		public int GetHeadBytesIdentity()
		{
			return 0;
		}

		/// <inheritdoc cref="P:HslCommunication.Core.IMessage.INetMessage.SendBytes" />
		// Token: 0x1700060F RID: 1551
		// (get) Token: 0x06001DC4 RID: 7620 RVA: 0x0008DDCE File Offset: 0x0008BFCE
		// (set) Token: 0x06001DC5 RID: 7621 RVA: 0x0008DDD6 File Offset: 0x0008BFD6
		public byte[] SendBytes { get; set; }
	}
}
